package com.cloxtec.scada.starting;


import com.cloxtec.scada.service.*;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


/**
 * Created by Administrator on 2022/7/8.
 */
@Component
@Slf4j
public class Starter implements CommandLineRunner {

    @Resource
    private RealTimeData realTimeData;

    @Resource
    private MqttSubClient mqttSubClient;

    @Resource
    private MqttPubClient mqttPubClient;

    @Resource
    private ScheduledTaskManager scheduledTaskManager;

    @Resource
    private ServerInfo serverInfo;

    @Resource
    private MsgManager msgManager;


    @Override
    public void run(String... strings) throws MqttException, InterruptedException {
        realTimeData.init();
        mqttPubClient.start();
        msgManager.init();
        scheduledTaskManager.init();
        mqttSubClient.start();
        serverInfo.start();
    }

}
